class Solution {
public:
    int hammingDistance(int x, int y) {
        //x^y,再统计1的个数
        int ret = 0;
        int n = x ^ y;
        while(n){
            ret ++;
            n &=(n-1);
        }
        return ret;
    }
};